﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XinYi.CrookedShow.Core;
using XinYi.CrookedShowMode;

namespace XinYi.CrookedShow.DAL
{
    public class IndexRepository
    {
        #region 分类信息显示
        //一级查询
        public List<Category> GetCategoryList()
        {
            //查表
            string sql = "select* from dbo.Category where ParentId=0 and CategoryLevel=1";
            //存入list
            return DapperHelper<Category>.QueryList(sql, null);
        }
        //二级查询
        public List<Category> GetTwoList2()
        {
            //查表
            string sql = "select* from dbo.Category where  CategoryLevel=2";
            //存入list
            return DapperHelper<Category>.QueryList(sql, null);
        }
        //三级查询
        public List<Category> GetThreeList3()
        {
            //查表
            string sql = "select* from dbo.Category where  CategoryLevel=3";
            //存入list
            return DapperHelper<Category>.QueryList(sql, null);
        }
        #endregion

        #region 商品信息显示
        public List<ProductSpuInfo> GetProduct_SpuList()
        {
            //查表
            string sql = "select Name,Pic_Url,Price from dbo.Product_Spu as s inner join dbo.Pic as p on s.Id=p.ProductId where Pic_Url like '%/theme%'";
            //存入list
            return DapperHelper<ProductSpuInfo>.QueryList(sql, null);
        }
        #endregion

        #region 品牌显示
        public List<Brand> GetBrandList()
        {
            //查表
            string sql = "select top 6 * from dbo.Brand ";
            //存入list
            return DapperHelper<Brand>.QueryList(sql, null);
        }
        #endregion
    }
}
